use serde::{Deserialize, Serialize};

use derivative::Derivative;

#[rbatis::crud_table(table_name:"tasks")]
#[derive(Serialize, Deserialize, Clone, Derivative, Debug)]
#[derivative(Default)]
pub struct TaskDBO {
  pub id: String,
  pub snapshot_at: String,
  pub pid: Option<String>,
  pub subject: String,
  pub title: Option<String>,
  pub description: Option<String>,

  pub assignee_id: String,

  pub quiz_item_id: String,

  pub ebp_last_at: Option<i64>,
  pub ebp_times_consec_fail: Option<u32>,
  pub ebp_times_consec_succ: Option<u32>,
  pub ebp_times_total: Option<u32>,

  pub ebp_difficulty: usize,

  pub ebp_forgetproba: usize,
  pub ebp_recalltime: i64,

  pub ebisu_modela: Option<i64>,
  pub ebisu_modelb: Option<i64>,
  pub ebisu_modelt: Option<i64>,

  pub created_at: i64,
  pub updated_at: i64,
  pub status: Option<String>,
}


#[rbatis::crud_table(table_name:"task_diff_proba")]
#[derive(Serialize, Deserialize, Clone, Derivative, Debug)]
#[derivative(Default)]
pub struct TaskDiffProbaDBO {
  pub id: String,

  pub difficulty: usize,
  pub probability: usize,
  pub interval: i64,
}
